﻿<Window x:Class="System.Reactive.Contrib.Monitoring.UI.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:local="clr-namespace:System.Reactive.Contrib.Monitoring.UI"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:po="http://schemas.microsoft.com/winfx/2006/xaml/presentation/options"
        Name="_win"
        Title="MainWindow"
        Width="{Binding Width,
                        Mode=TwoWay}"
        Height="600"
        MinWidth="550"
        MinHeight="350"
        AllowsTransparency="True"
        Background="Transparent"
        d:DesignHeight="500"
        d:DesignWidth="600"
        WindowStyle="None"
        mc:Ignorable="d">
    <Window.Resources>
        <local:TabTemplateSelector x:Key="_tabTemplateSelector" />
    </Window.Resources>
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="8" />
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="8" />
        </Grid.ColumnDefinitions>

        <Grid.RowDefinitions>
            <RowDefinition Height="8" />
            <RowDefinition Height="*" />
            <RowDefinition Height="8" />
        </Grid.RowDefinitions>

        <Border Grid.RowSpan="3"
                Grid.ColumnSpan="3"
                Height="6"
                Margin="4,42,4,0"
                VerticalAlignment="Top"
                BorderBrush="Black"
                BorderThickness="2"
                CornerRadius="0"
                po:Freeze="True">
            <Border.Background>
                <LinearGradientBrush po:Freeze="True" StartPoint="0,0.5" EndPoint="1,0.5">
                    <GradientStop Offset="0" Color="#FE757272" />
                    <GradientStop Offset="1" Color="#D1D8D8D8" />
                </LinearGradientBrush>
            </Border.Background>
        </Border>
        <DockPanel Grid.RowSpan="3"
                   Grid.ColumnSpan="3"
                   Margin="0"
                   Background="Transparent">
            <Border Margin="0,0,0,2"
                    BorderBrush="#FF151515"
                    BorderThickness="4"
                    CornerRadius="6"
                    Cursor="SizeAll"
                    DockPanel.Dock="Top"
                    MouseDown="OnDragHandler"
                    Padding="3">
                <Border.Background>
                    <LinearGradientBrush po:Freeze="True" StartPoint="0,0.5" EndPoint="1,0.5">
                        <GradientStop Offset="0" Color="#FE757272" />
                        <GradientStop Offset="1" Color="#D1D8D8D8" />
                    </LinearGradientBrush>
                </Border.Background>
                <Border.Effect>
                    <DropShadowEffect BlurRadius="5"
                                      Opacity="0.3"
                                      ShadowDepth="5"
                                      Color="#8E000000" />
                </Border.Effect>

                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="110" />
                        <ColumnDefinition Width="*" />
                    </Grid.ColumnDefinitions>
                    <Grid Margin="0,-6,0,0">
                        <TextBlock FontSize="24"
                                   FontWeight="Bold"
                                   Foreground="WhiteSmoke"
                                   po:Freeze="True"
                                   Text="Visual Rx">
                            <TextBlock.RenderTransform>
                                <TranslateTransform X="1" Y="1" />
                            </TextBlock.RenderTransform>
                        </TextBlock>
                        <TextBlock x:Name="_title"
                                   FontSize="24"
                                   FontWeight="Bold"
                                   Text="Visual Rx">
                            <TextBlock.Style>
                                <Style TargetType="TextBlock">
                                    <Style.Triggers>
                                        <DataTrigger Binding="{Binding Pinged}" Value="True">
                                            <DataTrigger.EnterActions>
                                                <BeginStoryboard>
                                                    <Storyboard>
                                                        <DoubleAnimation AutoReverse="True"
                                                                         Duration="0:0:2"
                                                                         Storyboard.TargetProperty="Opacity"
                                                                         To="0.4" />
                                                    </Storyboard>
                                                </BeginStoryboard>
                                            </DataTrigger.EnterActions>
                                        </DataTrigger>
                                    </Style.Triggers>
                                </Style>
                            </TextBlock.Style>
                        </TextBlock>
                    </Grid>
                    <TextBlock Grid.Column="1"
                               Margin="6,4,0,0"
                               VerticalAlignment="Top"
                               FontSize="9"
                               Foreground="#AA333333"
                               Text="{Binding Version,
                                              StringFormat=Version: {0},
                                              Mode=OneTime}">
                        <TextBlock.Effect>
                            <DropShadowEffect BlurRadius="4" Direction="330" Opacity="0.5"
                                              ShadowDepth="2" Color="White" />
                        </TextBlock.Effect>
                    </TextBlock>
                    <StackPanel Grid.Column="1" HorizontalAlignment="Right" Orientation="Horizontal">
                        <Button Height="30" MinWidth="70" Margin="0, 0, 5, 0"
                                Background="#FF636F8F" BorderBrush="Black"
                                Click="OnPauseHandler" FontSize="15" FontWeight="Heavy"
                                Content="{Binding PauseState}" Cursor="Arrow"
                                Style="{StaticResource GlassButton}" />
                        <Button Height="30" MinWidth="70" Margin="3, 0, 5, 0"
                                Background="#AA005985" BorderBrush="Black"
                                Command="{Binding ClearCommand, Mode=OneTime}"
                                Content="Clear" Cursor="Arrow" FontSize="15" FontWeight="Heavy"
                                Style="{StaticResource GlassButton}" />
                        <Button Height="30" MinWidth="70" Margin="3, 0, 5, 0"
                                Background="#AA0C7272" BorderBrush="Black"
                                Click="OnSettingHandler"
                                Content="Setting" Cursor="Arrow"
                                FontSize="15" FontWeight="Heavy"
                                Style="{StaticResource GlassButton}" />
                        <Button Height="30" MinWidth="70" Margin="3, 0, 5, 0"
                                Background="#AA175B23" BorderBrush="Black"
                                Click="OnAboutHandler"
                                Content="About" Cursor="Arrow"
                                FontSize="15" FontWeight="Heavy"
                                Style="{StaticResource GlassButton}" />

                        <Button Click="OnMinimizeHandler" Cursor="Arrow"
                                Style="{StaticResource GeometryButton}">
                            <LineGeometry po:Freeze="True" StartPoint="0,9" EndPoint="9,9" />
                        </Button>

                        <Button Margin="0,3,2,0" Click="OnCloseHandler" Cursor="Arrow"
                                Style="{StaticResource GeometryButton}">
                            <GeometryGroup>
                                <LineGeometry StartPoint="0,0" EndPoint="9,9" />
                                <LineGeometry StartPoint="0,9" EndPoint="9,0" />
                            </GeometryGroup>
                        </Button>
                    </StackPanel>
                </Grid>
            </Border>
            <Border Margin="0"
                    HorizontalAlignment="Stretch"
                    VerticalAlignment="Stretch"
                    Background="#333333"
                    BorderBrush="#FF151515"
                    BorderThickness="3"
                    CornerRadius="6"
                    Padding="3">
                <Border Background="Transparent"
                        BorderBrush="Black"
                        BorderThickness="0">

                    <Border.Effect>
                        <DropShadowEffect BlurRadius="10" ShadowDepth="0" />
                    </Border.Effect>

                    <TabControl Margin="2,5,2,3"
                                Background="#FF202020"
                                ContentTemplateSelector="{StaticResource _tabTemplateSelector}"
                                ItemsSource="{Binding Tabs, Mode=OneWay}"
                                SelectedItem="{Binding Selected}" />
                </Border>
            </Border>
        </DockPanel>

        <Thumb Grid.Row="0"
               Grid.Column="1"
               Cursor="SizeNS"
               DragDelta="OnResize"
               Opacity="0"
               Tag="T" />
        <Thumb Grid.Row="3"
               Grid.Column="1"
               Cursor="SizeNS"
               DragDelta="OnResize"
               Opacity="0"
               Tag="B" />
        <Thumb Grid.Row="1"
               Grid.RowSpan="2"
               Grid.Column="0"
               Cursor="SizeWE"
               DragDelta="OnResize"
               Opacity="0"
               Tag="L" />
        <Thumb Grid.Row="1"
               Grid.RowSpan="2"
               Grid.Column="2"
               Cursor="SizeWE"
               DragDelta="OnResize"
               Opacity="0"
               Tag="R" />
    </Grid>
</Window>